home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / mint / netlib / include / util.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-27  |  859 b   |  40 lines

  1. /*
  2.  *    Prototypes and the like for functions that may be used anywhere.
  3.  *
  4.  *    10/22/93, kay roemer.
  5.  */
  6.  
  7. #ifndef _UTIL_H
  8. #define _UTIL_H
  9.  
  10. /* Unlimited amount of data for FIONREAD/FIONWRITE */
  11. #define NO_LIMIT    0x7fffffffL
  12.  
  13. #define ALIGN2(x)    (((x) + 1) & ~1)
  14. #define ALIGN4(x)    (((x) + 3) & ~3)
  15.  
  16. #define MIN(x,y)    ((x) < (y) ? (x) : (y))
  17. #define MAX(x,y)    ((x) > (y) ? (x) : (y))
  18.  
  19. #define setstack(_sp) ({ \
  20.     register void *_osp = 0; \
  21.     __asm__ volatile("movel    sp, %0; movel %2, sp;" \
  22.              : "=a"(_osp) : "0"(_osp), "a"(_sp)); \
  23.     _osp; \
  24. })
  25.  
  26. #define spl7() ({ \
  27.     register short _sr = 0; \
  28.     __asm__ volatile("movew sr, %0; oriw #0x700, sr;" \
  29.              : "=d"(_sr) : "0"(_sr)); \
  30.     _sr; \
  31. })
  32.  
  33. #define spl(_sr) { __asm__ volatile("movew %0, sr;" :: "g"(_sr)); }
  34.  
  35. #ifndef NOEXTERNS
  36. extern char    stack[8192];
  37. #endif
  38.  
  39. #endif /* _UTIL_H */
  40.